pdf = Prawn::Document.new
# ensure default fonts are available
pdf.my_default_fonts

# set default font
pdf.font "Lato"

# add the header and footer on each page
pdf.repeat(:all) do
  # set the header
  pdf.bounding_box([0, 0], :width => 173, :height => 100) do
    pdf.my_logo_header
  end
  pdf.bounding_box([174, 0], :width => 173, :height => 100) do
    pdf.text "This text should be centered", :align =>:center
  end

  # set the footer
  pdf.my_footer_with_address
end

# set the body (content section)
#  -- (sizes based upon A4 format and size of header & footer, adjust as required)
#
pdf.bounding_box([0, 690], :width => 520, :height => 620) do

  # fix the font leading
  pdf.default_leading 1
  pdf.font_size 11

  10.times do

    pdf.text "Lorem ipsum <b>dolor sit amet</b>,...", :inline_format => true
    pdf.move_down 10

    # testing basic table support within the output
    data = [ ['Key', 'Value'],['1', 'A'],['2','B'],['3','C'],['4','D'],['5','F']]
    pdf.table(data, :column_widths => [35, 70], :cell_style => { :border_color => 'CCCCCC', :border_width => 1 }) do
      row(0).font_style = :bold
      row(0).border_bottom_color = '333333'
    end

    pdf.move_down 20

  end

  # NOTE!! we must set page numbers within the bounding_box() to get them correctly displayed
  pdf.my_page_numbers("- <page> of <total> -")
end
